package com.powerbank.common.event.order;

import lombok.Data;
import java.time.LocalDateTime;

/**
 * 订单状态变更事件
 */
@Data
public class OrderStatusChangedEvent {

    /**
     * 订单ID
     */
    private Long orderId;

    /**
     * 订单号
     */
    private String orderNo;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 旧状态
     */
    private String oldStatus;

    /**
     * 新状态
     */
    private String newStatus;

    /**
     * 变更原因
     */
    private String reason;

    /**
     * 创建时间
     */
    private LocalDateTime createdTime;

    public OrderStatusChangedEvent() {
        this.createdTime = LocalDateTime.now();
    }

    public OrderStatusChangedEvent(Long orderId, String orderNo, Long userId, String oldStatus, String newStatus, String reason) {
        this.orderId = orderId;
        this.orderNo = orderNo;
        this.userId = userId;
        this.oldStatus = oldStatus;
        this.newStatus = newStatus;
        this.reason = reason;
        this.createdTime = LocalDateTime.now();
    }
}